﻿using BCCommon.Enums;
using BCCommon.Extensions;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Text;

namespace BCEntity.MongoDB.Location
{
    /// <summary>
    /// 员工位置信息
    /// </summary>
    public class LocationStaffEntity
    {
        private double longitude;
        private double latitude;

        [BsonId]
        /// <summary>
        /// kafka临时消息Id
        /// </summary>
        [BsonElement("TemplateMessageId")]
        public string TemplateMessageId { get; set; }
        /// <summary>
        /// 员工Id
        /// </summary>
        [BsonElement("AdminId")]
        public long AdminId { get; set; }
        /// <summary>
        /// 位置更新时间
        /// </summary>
        [BsonElement("ModifyTime")]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifyTime { get; set; }
        /// <summary>
        /// 所在位置精度
        /// </summary>
        [BsonElement("Longitude")]
        public double Longitude { get { return this.longitude; } set { this.longitude = Math.Round(value, 8); } }
        /// <summary>
        /// 所在位置维度
        /// </summary>
        [BsonElement("Latitude")]
        public double Latitude { get { return this.latitude; } set { this.latitude = Math.Round(value, 8); } }
        /// <summary>
        /// 所在位置精维度
        /// </summary>
        [BsonElement("Coordinate")]
        public double[] Coordinate { get; set; }
        /// <summary>
        /// 管理员姓名
        /// </summary>
        [BsonElement("FullName")]
        public string FullName { get; set; }
        /// <summary>
        /// 是否为公司负责人
        /// </summary>
        [BsonElement("IsMain")]
        public bool IsMain { get; set; }
        /// <summary>
        /// 公司Id
        /// </summary>
        [BsonElement("CompanyId")]
        public int CompanyId { get; set; }
        /// <summary>
        /// 公司名称
        /// </summary>
        [BsonElement("CompanyName")]
        public string CompanyName { get; set; }
        /// <summary>
        /// 公司业务类型
        /// </summary>
        [BsonElement("BusinessType")]
        public string BusinessType { get; set; }
        /// <summary>
        /// 公司业务类型名称
        /// </summary>
        [BsonElement("BusinessTypeName")]
        public string BusinessTypeName { get; set; }
        /// <summary>
        /// 是业务总公司
        /// </summary>
        [BsonElement("IsBusinessHeadOffice")]
        public bool? IsBusinessHeadOffice { get; set; }
        /// <summary>
        /// 是否集团总部
        /// </summary>
        [BsonElement("IsHeadOffice")]
        public bool IsHeadOffice { get; set; }
        /// <summary>
        /// 账号状态
        /// </summary>
        [BsonElement("AccountStatus")]
        public AccountStatus AccountStatus { get; set; }
        /// <summary>
        /// 账号状态
        /// </summary>
        [BsonElement("AccountStatusStr")]
        public string AccountStatusStr => this.AccountStatus.GetDescriptionString();
        /// <summary>
        /// 管理员头像
        /// </summary>
        [BsonElement("Avatar")]
        public string Avatar { get; set; }

        /// <summary>
        /// 手机号
        /// </summary>	
        [BsonElement("Phone")]
        public string Phone { get; set; }
        /// <summary>
        /// 家庭住址
        /// </summary>	
        [BsonElement("HomeAddress")]
        public string HomeAddress { get; set; }
        /// <summary>
        /// 身份证号
        /// </summary>	
        [BsonElement("IdCard")]
        public string IdCard { get; set; }
        /// <summary>
        /// 性别
        /// </summary>	
        [BsonElement("Sex")]
        public Sex Sex { get; set; }
        /// <summary>
        /// 性别
        /// </summary>	
        [BsonElement("SexStr")]
        public string SexStr => this.Sex.GetDescriptionString();
        /// <summary>
        /// 紧急联系人
        /// </summary>	
        [BsonElement("EmergencyContact")]
        public string EmergencyContact { get; set; }
        /// <summary>
        /// 紧急联系电话
        /// </summary>	
        [BsonElement("EmergencyPhone")]
        public string EmergencyPhone { get; set; }
        /// <summary>
        /// 家庭成员数
        /// </summary>	
        [BsonElement("FamilyNumber")]
        public int FamilyNumber { get; set; }
        /// <summary>
        /// 子女数量
        /// </summary>
        [BsonElement("ChildrenNumber")]
        public int ChildrenNumber { get; set; }
        /// <summary>
        /// 职务名称
        /// </summary>
        [BsonElement("JobDuty")]
        public string JobDuty { get; set; }
        /// <summary>
        /// 职位名称
        /// </summary>	
        [BsonElement("JobTitle")]
        public string JobTitle { get; set; }
        /// <summary>
        /// 入职时间
        /// </summary>	
        [BsonElement("EmployedDate")]
        public DateTime EmployedDate { get; set; }
        /// <summary>
        /// 离职时间
        /// </summary>	
        [BsonElement("LeaveTime")]
        public DateTime? LeaveTime { get; set; }
        /// <summary>
        /// 部门名称
        /// </summary>
        [BsonElement("DepartmentName")]
        public string DepartmentName { get; set; }
        /// <summary>
        /// GPS IMEI号
        /// </summary>
        [BsonElement("GpsImei")]
        public string GpsImei { get; set; }
    }
}
